﻿using System;
using System.IO;
using NewLife.Xml;

namespace GitPuller.Configurations
{
    public class GitPullerConfiguration : XmlConfig<GitPullerConfiguration>
    {
        public String Root { get; set; }
        public bool Standalone { get; set; }
        protected override void OnNew()
        {
            Root = AppDomain.CurrentDomain.BaseDirectory;
            if (!Path.IsPathRooted(Root)) Root = Path.GetDirectoryName(Root);
            Standalone = true;
        }
        protected override void OnLoaded()
        {
            base.OnLoaded();
            if (this.Standalone)
            {
                this.Root = AppDomain.CurrentDomain.BaseDirectory;
            }
        }
    }
}
